﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BattleOfColors.Control
{
    public enum RamdomMethod
    {
        DEFAULT_CSHARP
    }

    public class Randomizer
    {
        private static Randomizer _instance;

        public static Randomizer Instance
        {
            get {
                if (_instance == null)
                {
                    _instance = new Randomizer();
                }

                return _instance; 
            }
            set { _instance = value; }
        }

        private int _seed;

        private int _prime;

        private RamdomMethod _method;

        private Random _random;

        private Randomizer()
        {
            _method = RamdomMethod.DEFAULT_CSHARP;
            _prime = 13;
            _seed = DateTime.Now.Millisecond * _prime;
            _random = new Random(_seed);
        }

        /// <summary>
        /// Retorna um valor aleatório de 0 até o valor informado
        /// </summary>
        /// <param name="range"></param>
        /// <returns></returns>
        public int Next(int range)
        {
            switch (_method)
            {
                case RamdomMethod.DEFAULT_CSHARP:
                    return _random.Next(range);
            }

            return -1;
        }
    }
}
